const crypto = require("crypto");
const jwt = require("jsonwebtoken");
module.exports = {
    passwordEncoder(raw_password) {
        return crypto
            .createHmac("sha256", "123")
            .update(raw_password)
            .digest("hex");
    },
    genToken(user) {
        return jwt.sign(user, this.app.config.keys, { expiresIn: "2h" });
    },
    checkToken(token) {
        return jwt.verify(token, this.app.config.keys);
    },
};
